﻿<html>
  <center>
  <title>MÁY IN</title>
  <form method= POST action ="">
  <h1> <font color ="blue"> Máy In </h1></center>
  <hr width=45%>  
  <br>Trọng lượng: <input type=text name="trongluong"><font color ="Black">(Kg)</font>
  <br>Năm Sản Xuất: <input type=text name="nsx">
  <br>Hãng Sản Xuất: <input type=text name="hsx">	</font>	 	 
</html>
  <?php
 class mayin
 
   {
 function xuatmayin()
	  {
		if(isset($_POST['trongluong'])&&isset($_POST['nsx'])&&isset($_POST['hsx']))
		{
	 $trongluong=$_POST['trongluong'];
	 $nsx=$_POST['nsx'];
	 $hsx=$_POST['hsx'];
	 $tl=(is_numeric($trongluong)==1&&$trongluong>0 && $trongluong!=null)?$trongluong:" Khong Dung";
		   {
		echo "<br> Trong luong may: ".$tl; 
           }	
     $namsx=(is_numeric($nsx)==1 && strlen($nsx)==4 && $nsx>1900 && $nsx <=date('Y'))?$nsx:" Khong dung";
		{
		echo "<br> Nam san xuat : ".$namsx;	
		 }
	$hangsx=(is_numeric($hsx)!=1&&($hsx)!=null)?$hsx:" Khong dung";
          {
          echo "<br> Hang san xuat : ".$hangsx;
           }							  
	}
	} 	 
   }
 class mayin_kim extends mayin
			{
		 
		 function nhap()
			{
			echo '
		<br>So Kim: <input type=text name="sokim">
		<br>Toc Do In: <input type=text name="tocdoin">(trang/phut)
		';				
			 }
			 
		 function xuat()
			 {
			echo "<BR>MAY IN KIM";
			$this->xuatmayin();
			if(isset($_POST['sokim'])&&isset($_POST['tocdoin']))
			{
			$sokim=$_POST['sokim']; 
		 $tocdoin=$_POST['tocdoin'];
		$sk=(is_numeric($sokim)==1&&$sokim>0 && $sokim<60 &&($sokim)!=null)? $sokim:"Khong dung";
             {
               echo "<br> So kim : ".$sk;	
             }
               $td=(is_numeric($tocdoin)==1&&$tocdoin>0 && $tocdoin<55 &&($tocdoin)!=null)?$tocdoin:" Khong dung";
                             {
                                  echo "<br> Toc do in : ".$td;
                              }								  
					    }
				 
			  }
			 
	}
  class mayin_laser extends mayin
    {
		 function nhap()
				{
					  echo '
							   <br>Do Phan Giai:
								<select name="dophangiai" size="1" width=110%>
								<option selected> 								
								<option> 600x600 DPI
								<option> 1200x1200 DPI
								<option> 2400x1200 DPI													
								</select>
								(<font color=red>int</font>)
							   <br>Toc do in: <input type=text name="tocdo2">
							  ';				
				 }
				 
		 function xuat()
				 {
					   echo "<BR> <FONT COLOR=RED >MAY IN LASER </FONT>";
					   $this->xuatmayin();
					   if(isset($_POST['dophangiai'])&&isset($_POST['tocdo2']))
						   {
				$dophangiai=$_POST['dophangiai']; 
				 $tocdo2=$_POST['tocdo2'];
				$dpg=(($dophangiai)!=null)?$dophangiai:"Khong dung";
                  {
                                  echo "<br> Do Phan Giai: ".$dpg;
                }
							   $td2=(is_numeric($tocdo2)==1&& $tocdo2>0 && $tocdo2<30 &&($tocdo2)!=null)?$tocdo2:" Khong dung";
                {
                                  echo "<br> Toc do in : ".$td2;
                }
				}	 
				  }		 
	}
$mayin_kim= new mayin_kim();
$mayin_kim->nhap();
$mayin_laser= new mayin_laser();
$mayin_laser->nhap();
 echo '<br><input type="submit" name="Tim Kiem" value="Tim Kiem"><input type="reset" name="Xoa" value="Xoa"><br><hr width =100%>';
 $mayin_kim->xuat();
 $mayin_laser->xuat();  
?>

